package 去空去重;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class MapTest extends Mapper<LongWritable, Text, Text, NullWritable> {
    Text k = new Text();

    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        String[] datas = value.toString().split(",",-1);
        if (datas[0].isEmpty() || datas[1].isEmpty()) return;
        k.set(datas[0]+","+datas[1]);
        context.write(k,NullWritable.get());
    }
}
